export default {
  state: {
    isShowClass: false,
    courses: [], // 第一页的课程列表
    currentWeek: { // 点击进入一周课表 需要传的参数
      classId: '',
      startTime: '',
      endTime: ''
    },
    weekCourses: [] // 第二页 一周的课程
  },
  getters: {
    // school: state => state.now_school,
  },
  actions: {
    changeIsShowClass ({ state, commit }, val) {
      commit('changeIsShowClass', val)
    },
    getCourses ({ state, commit }) {
      // 接口请求
      const list = [
        {
          id: 1,
          className: '教室名称',
          data: [
            {
              id: 1,
              num: 121,
              startTime: '2020-07-08 15:00',
              endTime: '2020-07-08 19:00'
            },
            {
              id: 2,
              num: 12,
              startTime: '2020-06-08 15:00',
              endTime: '2020-06-08 19:00'
            }
          ]
        },
        {
          id: 2,
          className: '教室名称2',
          data: [
            {
              id: 1,
              num: 12,
              startTime: '2020-07-28 15:00',
              endTime: '2020-07-28 19:00'
            },
            {
              id: 2,
              num: 12,
              startTime: '2020-08-08 15:00',
              endTime: '2020-08-08 19:00'
            }
          ]
        }
      ]

      commit('setCourses', list)
    },
    getWeekCourses ({ state, commit }) {
      // 接口请求  向接口传参数：currentWeek
      const list = [
        {
          id: 1,
          className: '教室名称',
          data: [
            {
              id: 1,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 1,
              teacherName: '王老师'
            },
            {
              id: 2,
              time: '14:00',
              minutes: '65',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 3,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 4,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 5,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 6,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 7,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            }
          ]
        },
        {
          id: 2,
          className: '教室名称2',
          data: [
            {
              id: 1,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 2,
              time: '14:00',
              minutes: '65',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 3,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 4,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 5,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 6,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            },
            {
              id: 7,
              time: '17:00',
              minutes: '45',
              classroom: '美术一班',
              teacherNum: 2,
              teacherName: '王老师'
            }
          ]
        }
      ]

      commit('setWeekCourses', list)
    }
  },
  mutations: {
    changeIsShowClass (state, val) {
      state.isShowClass = val
    },
    setCourses (state, list) {
      state.courses = list
    },
    changeCurrentWeek (state, val) {
      state.currentWeek = val
    },
    setWeekCourses (state, list) {
      state.weekCourses = list
    }
  }
}
